import service from '@/utils/axios';
import { IResponseType, PageVO } from '@/api/common';
import {
    ColumnAddRO,
    ColumnEditRO,
    ColumnPageRO,
    ColumnVO
} from '@/api/content/column/column';

export const getColumnInfo = (id: string) => {
    return service<IResponseType<ColumnVO>>({
        url: '/content/column/get/' + id,
        method: 'post'
    });
};

export const getColumnPage = (pageRO: ColumnPageRO) => {
    return service<IResponseType<PageVO<ColumnVO>>>({
        url: '/content/column/page',
        method: 'post',
        data: pageRO
    });
};

export const getColumnAll = async () => {
    return service<IResponseType<PageVO<ColumnVO>>>({
        url: '/content/column/page',
        method: 'post',
        data: {
            current: 1,
            size: 1000
        }
    });
};

export const addColumn = (data: ColumnAddRO) => {
    return service<IResponseType<void>>({
        url: '/content/column/add',
        method: 'post',
        data
    });
};

export const editColumn = (data: ColumnEditRO) => {
    return service<IResponseType<void>>({
        url: '/content/column/edit',
        method: 'post',
        data
    });
};

export const remove = (ids: string) => {
    return service<IResponseType<void>>({
        url: '/content/column/remove/' + ids,
        method: 'post'
    });
};